package com.yuqiangz.springsecurity.controller;

import com.yuqiangz.springsecurity.domain.ResponseResult;
import com.yuqiangz.springsecurity.domain.User;
import com.yuqiangz.springsecurity.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author zhaoyuqiang
 * @create 2024/5/22 6:54
 * @description
 */
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;


    @PostMapping("/user/login")
    public ResponseResult<Map<String, String>> login(@RequestBody User user){
        return loginService.login(user);
    }

    @GetMapping("/user/logout")
    public ResponseResult<String> logout(){
        return loginService.logout();
    }
}
